﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using SuperMap.Data;
using SuperMap.Mapping;


namespace MDF
{
    class CoordPosition
    {
        //初始变量
        private Map m_map;
        private ZBDW m_zbdw;
        private Workspace m_workspace;
        //private Datasource m_datasource;
        /// <summary>
        /// 初始化构造函数，需要Map
        /// </summary>
        /// <param name="map">传递当前地图</param>
        public CoordPosition(Map map)
        {
            m_map = map;
        }
        /// <summary>
        /// 初始化构造函数
        /// </summary>
        /// <param name="workspace">传递工作空间</param>
        public CoordPosition(Workspace workspace)
        {
            try
            {
                //获取变量数据
                m_workspace = workspace;


            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
        /// <summary>
        /// 坐标定位窗口
        /// </summary>
        /// <param name="map">用户当前打开的地图</param>
        /// <param name="point">坐标定位窗体的初始位置</param>
        public void Open_ZBDW(Map map, Point point)
        {
            try
            {
                if (m_zbdw == null || m_zbdw.IsDisposed)//判断窗体是否已经打开
                {
                    m_zbdw = new ZBDW(map);
                    m_zbdw.Location = point;
                    m_zbdw.Show();
                }
                else
                {
                    m_zbdw.Location = point;
                    m_zbdw.Activate();
                }               
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
